package com.itheima.day09;

import java.util.Scanner;

public class Test6 {
    /*
    需求：键盘录入一个 字符串，如果字符串中包含（TMD），则使用***替换
     */
    public static void main(String[] args) {
        //1.键盘录入一个字符串,用Scanner实现
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入:");
        String s = sc.next();

        //2.创建一个数组容器
        String[] arr = {"TMD","tmd","Tmd","sb","SB"};

        //3.将s的值赋给s1,保留源数据
        String s1 = s;

        //4.替换敏感词汇
        for (int i = 0; i < arr.length; i++) {
            s1 = s1.replace(arr[i],"**");
        }
        //5.输出打印
        System.out.println(s1);
    }
}
